<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
 
<s:layout-render name="/newjsp.jsp">
    <s:layout-component name="hlavicka">
        <f:message key="nadpis.customers"/>
    </s:layout-component>
    <s:layout-component name="telo">
        <s:useActionBean beanclass="pneuservis.frontend.web.CustomersActionBean" var="actionBean"/>
        <f:message key="key.allCustomers" />
        <table class="zakladni" >
            <tr>
                <th><f:message key="key.ID" /></th>
                <th><f:message key="key.name" /></th>
                <th><f:message key="key.phone" /></th>
                <th><f:message key="key.address" /></th>
                <th>username</th>
                <th>password</th>
            </tr>
            <c:forEach items="${actionBean.customers}" var="customer">
                <tr>
                    <td>${customer.id}</td>
                    <td><c:out value="${customer.name}"/></td>
                    <td><c:out value="${customer.phone}"/></td>
                    <td><c:out value="${customer.address}"/></td>
                    <td><c:out value="${customer.username}"/></td>
                    <td><c:out value="${customer.password}"/></td>
                    <td><s:link beanclass="pneuservis.frontend.web.CustomersActionBean" event="delete" onclick="return confirm('Delete ${customer}?');"><s:param name="customer.id" value="${customer.id}"/><f:message key="key.delete" /></s:link> </td>
                    <td><s:link beanclass="pneuservis.frontend.web.CustomersActionBean" event="edit"><s:param name="customer.id" value="${customer.id}"/><f:message key="key.edit" /></s:link> </td>
                </tr>
            </c:forEach>
        </table>
        <s:form beanclass="pneuservis.frontend.web.CustomersActionBean">
            <fieldset>
                <legend><f:message key="key.newCustomer" /></legend>
                <%@include file="formCustomer.jsp"%>
                <s:submit name="add"><f:message key="key.newCustomer1" /></s:submit>
            </fieldset>
        </s:form>
    </s:layout-component>
</s:layout-render>